﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data;

namespace DataAccessLayer
{
    public interface IHandleDB
    {
        int GetMaxId(string FieldName, string TableName);
        bool Exists(string strSql); //重载  bool Exists(string strSql, params OleDbParameter[] cmdParms)


        #region  基本的CRUD
        /// <summary>    
        /// 执行SQL语句，返回影响的记录数    
        /// </summary>    
        /// <param name="SQLString">SQL语句</param>    
        /// <returns>影响的记录数</returns>    ur32 
        int ExecuteNonQuery(string SQLString);

        int ExecuteNonQuery(string SQLString, params OleDbParameter[] cmdParms);

        /// <summary>    
        /// 执行SQL语句，设置命令的执行等待时间    
        /// </summary>    
        /// <param name="SQLString"></param>    
        /// <param name="Times"></param>    
        /// <returns></returns>    
        int ExecuteSqlByTime(string SQLString, int Times);

        /// <summary>    
        /// 执行多条SQL语句，实现数据库事务。    
        /// </summary>    
        /// <param name="SQLStringList">多条SQL语句</param>        
        void ExecuteSqlTran(ArrayList SQLStringList);

        /// <summary>    
        /// 执行多条SQL语句，实现数据库事务。    
        /// </summary>    
        /// <param name="SQLStringList">SQL语句的哈希表（key为sql语句，value是该语句的OleDbParameter[]）</param>    
        void ExecuteSqlTran(Hashtable SQLStringList);

        /// <summary>    
        /// 执行一条计算查询结果语句，返回查询结果（object）。    
        /// </summary>    
        /// <param name="SQLString">计算查询结果语句</param>    
        /// <returns>查询结果（object）</returns>    
        object ExecuteScalar(string SQLString);   //object ExecuteScalar(string SQLString, params OleDbParameter[] cmdParms)

        /// <summary>    
        /// 执行查询语句，返回SqlDataReader(使用该方法切记要手工关闭SqlDataReader和连接)    
        /// </summary>    
        /// <param name="strSQL">查询语句</param>    
        /// <returns>SqlDataReader</returns>    
        OleDbDataReader ExecuteReader(string strSQL);

        OleDbDataReader ExecuteReader(string SQLString, params OleDbParameter[] cmdParms);

        /// <summary>    
        /// 执行查询语句，返回DataSet,设置命令的执行等待时间    
        /// </summary>    
        /// <param name="SQLString"></param>    
        /// <param name="Times"></param>    
        /// <returns></returns>    
        DataSet Query(string SQLString, int Times);
        DataSet Query(string SQLString, params OleDbParameter[] cmdParms);

        #endregion



    }
}
